<?php

/**
 * Trader filter form base class.
 *
 * @package    truetrader
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseTraderFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'user_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'), 'add_empty' => true)),
      'character_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TraderCharacter'), 'add_empty' => true)),
      'follower_access_id'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('FollowerAccess'), 'add_empty' => true)),
      'sex_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Sex'), 'add_empty' => true)),
      'username'              => new sfWidgetFormFilterInput(),
      'birthday'              => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'country'               => new sfWidgetFormFilterInput(),
      'city_code'             => new sfWidgetFormFilterInput(),
      'picture'               => new sfWidgetFormFilterInput(),
      'phone'                 => new sfWidgetFormFilterInput(),
      'mobile_phone'          => new sfWidgetFormFilterInput(),
      'skype_address'         => new sfWidgetFormFilterInput(),
      'personnal_description' => new sfWidgetFormFilterInput(),
      'job'                   => new sfWidgetFormFilterInput(),
      'asset'                 => new sfWidgetFormFilterInput(),
      'started'               => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'weekly_hour'           => new sfWidgetFormFilterInput(),
      'credit'                => new sfWidgetFormFilterInput(),
      'follow_credit'         => new sfWidgetFormFilterInput(),
      'follower_count'        => new sfWidgetFormFilterInput(),
      'followed_count'        => new sfWidgetFormFilterInput(),
      'leaver_count'          => new sfWidgetFormFilterInput(),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'user_id'               => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUser'), 'column' => 'id')),
      'character_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TraderCharacter'), 'column' => 'id')),
      'follower_access_id'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('FollowerAccess'), 'column' => 'id')),
      'sex_id'                => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Sex'), 'column' => 'id')),
      'username'              => new sfValidatorPass(array('required' => false)),
      'birthday'              => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'country'               => new sfValidatorPass(array('required' => false)),
      'city_code'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'picture'               => new sfValidatorPass(array('required' => false)),
      'phone'                 => new sfValidatorPass(array('required' => false)),
      'mobile_phone'          => new sfValidatorPass(array('required' => false)),
      'skype_address'         => new sfValidatorPass(array('required' => false)),
      'personnal_description' => new sfValidatorPass(array('required' => false)),
      'job'                   => new sfValidatorPass(array('required' => false)),
      'asset'                 => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'started'               => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'weekly_hour'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'credit'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'follow_credit'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'follower_count'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'followed_count'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'leaver_count'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('trader_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Trader';
  }

  public function getFields()
  {
    return array(
      'id'                    => 'Number',
      'user_id'               => 'ForeignKey',
      'character_id'          => 'ForeignKey',
      'follower_access_id'    => 'ForeignKey',
      'sex_id'                => 'ForeignKey',
      'username'              => 'Text',
      'birthday'              => 'Date',
      'country'               => 'Text',
      'city_code'             => 'Number',
      'picture'               => 'Text',
      'phone'                 => 'Text',
      'mobile_phone'          => 'Text',
      'skype_address'         => 'Text',
      'personnal_description' => 'Text',
      'job'                   => 'Text',
      'asset'                 => 'Number',
      'started'               => 'Date',
      'weekly_hour'           => 'Number',
      'credit'                => 'Number',
      'follow_credit'         => 'Number',
      'follower_count'        => 'Number',
      'followed_count'        => 'Number',
      'leaver_count'          => 'Number',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
    );
  }
}
